home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Celestin Apprentice 5
/
Apprentice-Release5.iso
/
Source Code
/
PowerPlant
/
AGA Classes 1.2
/
Utilities
/
LAGASeparator.cp
< prev
next >
Wrap
Text File
|
1996-06-30
|
4KB
|
134 lines
// ===========================================================================
// LAGASeparator.cp
// ===========================================================================
// “Apple Grayscale Appearance” compliant separator
// Copyright © 1996 Chrisoft (Christophe ANDRES) All rights reserved.
//
// You may use this source code in any application (commercial, shareware, freeware,
// postcardware, etc), but not remove this notice (no need to acknowledge the use of
// this class in the about box)
// You may not sell this source code in any form. This source code may be placed on
// publicly accessable archive sites and source code disks. It may not be placed on
// profit archive sites and source code disks without the permission of the author,
// Christophe ANDRES.
//
// This source code is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
//
// If you make any change or improvement on this class, please send the improved/changed
// version to : chrisoft@calva.net or Christophe ANDRES
// 20, rue Prosper Mérimée
// 67100 STRASBOURG
// FRANCE
//
// ===========================================================================
// LAGASeparator.h <- double-click + Command-D to see class declaration
//
// LAGASeparator is my implementation of the “Apple Grayscale Appearance for System 7.5”
// Separator. Whether the Pane will be a horizontal or vertical separator is determined
// by the greatest of width or height.
//
//
// This class requires AGAColors.cp to be present in your project
//
// Version : 1.2
//
// Change History (most recent first, date in US form : mm/dd/yy):
//
// 06/30/96 ca Public release of version 1.2
// 06/24/96 ca Added StColorPenState::Normalize call to prevent influence on our colors
// 06/05/96 ca Added RegisterClass method to ease registry
// Increased version to 1.2
// 05/17/96 ca Increased version to 1.1
// Added copy constructor
// Added "on the fly" constructor
// Replaced UEnvironment::HasFeature(env_SupportsColor) with PaneInColor
// Added change history
// 04/22/96 ca class made available by Christophe ANDRES <chrisoft@calva.net>
// (version 1.0)
//
// To Do:
//
#include "LAGASeparator.h"
#include <UEnvironment.h>
#include <UTextTraits.h>
#include "AGAColors.h"
// begin <06/05/96 ca>
void LAGASeparator::RegisterClass ()
{
URegistrar::RegisterClass(LAGASeparator::class_ID, (ClassCreatorFunc)LAGASeparator::CreateAGASeparatorStream);
}
// end <06/05/96 ca>
LAGASeparator* LAGASeparator::CreateAGASeparatorStream (LStream* inStream)
{
return (new LAGASeparator(inStream));
}
//-------Constructors-------------------------------------------------------------------------------------------------
LAGASeparator::LAGASeparator (LStream *inStream) : LPane(inStream)
{
}
// begin <05/17/96 ca>
LAGASeparator::LAGASeparator (const LAGASeparator &inOriginal) : LPane(inOriginal)
{
}
LAGASeparator::LAGASeparator (const SPaneInfo &inPaneInfo) : LPane(inPaneInfo)
{
}
// end <05/17/96 ca>
//-------Drawers----------------------------------------------------------------------------------------------------
void LAGASeparator::DrawSelf ()
{
StColorPenState theState;
Boolean hasColor = ::PaneInColor(this); // <05/17/96 ca>
Rect frame;
theState.Normalize(); // <06/24/96 ca>
CalcLocalFrameRect(frame);
if (hasColor)
::RGBForeColor(&gAGAColorArray[7]);
else
::PenPat(&qd.gray);
if ((frame.bottom - frame.top) > (frame.right - frame.left))
{
// vertical separator
::MoveTo(frame.left, frame.top);
::LineTo(frame.left, frame.bottom - 2);
if (hasColor)
{
::ForeColor(whiteColor);
::MoveTo(frame.left + 1, frame.top + 1);
::LineTo(frame.left + 1, frame.bottom - 1);
}
}
else
{
// horizontal separator
::MoveTo(frame.left, frame.top);
::LineTo(frame.right - 2, frame.top);
if (hasColor)
{
::ForeColor(whiteColor);
::MoveTo(frame.left + 1, frame.top + 1);
::LineTo(frame.right - 1, frame.top + 1);
}
}
}